package com.haizhi.crm.api.controller.sys.auth;

import com.haizhi.crm.common.model.Response;
import com.haizhi.crm.sys.auth.service.ResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by yangyijun on 2018/5/17.
 */
@Api(description = "[系统-资源]" )
@RestController
@RequestMapping("/auth/resource" )
public class ResourceController {

    @Autowired
    private ResourceService resourceService;

    @GetMapping("/findAll" )
    @ApiOperation(value = "权限管理-查询所有资源", notes = "已经拼接成树形结构;subs表示当前资源的子资源" )
    public Response findAll() {
        return resourceService.findAll();
    }

    @GetMapping("/findForRelationPermission" )
    @ApiOperation(value = "权限管理-查询关系权限资源", notes = "已经拼接成树形结构;subs表示当前资源的子资源" )
    public Response findForRelationPermission() {
        return resourceService.findForRelationPermission();
    }
}
